﻿<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <link href="/static/img/logo500x500.png" rel="shortcut icon">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover">
    <title>忘记密码</title>
    <link rel="stylesheet" href="/static/css/login/global.css">
    <link href="https://cdn.bootcdn.net/ajax/libs/animate.css/4.1.1/animate.compat.min.css" rel="stylesheet">
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script src="/static/layui/layui.js" charset="utf-8"></script>
    <script>
        window.onload = function () {
            document.getElementById("jsSendCaptcha").setAttribute("disabled", "disabled");
            document.getElementById("regist").setAttribute("disabled", "disabled");
        }
    </script>
    <style>

        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
            -webkit-transition: all 0.25s cubic-bezier(0.37, 0, 0.45, 0.99);
            transition: all 0.25s cubic-bezier(0.37, 0, 0.45, 0.99);
        }
        *:before, *:after {
            box-sizing: inherit;
        }

        img {
            max-width: 100%;
            height: auto;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Fira Sans", "Helvetica Neue", sans-serif;
            line-height: 1.75;
            height: 100%;
            background-image: url("/static/img/bannerV2.jpg");
            background-position: center center;
            /* 背景图不平铺 */
            background-repeat: no-repeat;
            /* 当内容高度大于图片高度时，背景图像的位置相对于viewport固定 */
            background-attachment: fixed;
            /* 让背景图基于容器大小伸缩 */
            background-size: cover;
        }

        @-webkit-keyframes driving {
            0% {
                -webkit-transform: translateY(-650px);
                transform: translateY(-650px);
            }
            100% {
                -webkit-transform: translateY(0);
                transform: translateY(0);
            }
        }

        @keyframes driving {
            0% {
                -webkit-transform: translateY(-650px);
                transform: translateY(-650px);
            }
            100% {
                -webkit-transform: translateY(0);
                transform: translateY(0);
            }
        }
        .hero__title {
            padding: 3em 2rem 16rem;
            text-align: center;
            font-size: 32pt;
            color: white;
            position: relative;
            z-index: 0001;
        }

        .gps-bg {
            /*background-image: url("/static/img/bannerV2.jpg");*/
            /*background-repeat: no-repeat;*/
            position: relative;
            -webkit-perspective: 500px;
            perspective: 500px;
            overflow: hidden;
        }
        .gps-bg__guts {
            position: absolute;
            -webkit-transform: rotateX(45deg);
            transform: rotateX(45deg);
            width: calc(100% + 1000px);
            height: 100%;
            left: -500px;
        }
        .gps-bg__bg {
            height: 2600px;
            background-image: url(/static/img/roads.svg);
            background-position: 50%;
            background-size: 65%;
            position: absolute;
            top: -162px;
            width: 100%;
            -webkit-transform: translateY(-650px);
            transform: translateY(-650px);
            -webkit-animation: driving 10000ms linear 0ms infinite;
            animation: driving 10000ms linear 0ms infinite;
        }
        .gps-bg__route {
            width: 2em;
            background-color: #fff;
            position: absolute;
            top: -350px;
            bottom: -162px;
            left: 50%;
            -webkit-transform: translateX(-50%);
            transform: translateX(-50%);
            box-shadow: 0 0 13px 5px rgba(46, 18, 107, 0.25);
        }
        .gps-bg__route:after {
            content: '';
            width: 60%;
            background-color: #6c38de;
            position: absolute;
            top: 0;
            bottom: 35%;
            left: 50%;
            -webkit-transform: translateX(-50%);
            transform: translateX(-50%);
        }
        .gps-bg__fade {
            background-image: -webkit-linear-gradient(top, #ac8dff 10%, rgba(172, 141, 255, 0) 100%);
            background-image: linear-gradient(to bottom, #ac8dff 10%, rgba(172, 141, 255, 0) 100%);
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 60%;
            z-index: 1;
        }
        .gps-bg__marker {
            height: 6em;
            width: 6em;
            background-color: #fff;
            border-right: 1px solid #ddd;
            border-bottom: 3px solid #ddd;
            border-left: 1px solid #ddd;
            border-radius: 100%;
            position: absolute;
            top: 46%;
            left: 48.5%;
            -webkit-transform: translateX(-50%);
            transform: translateX(-50%);
            box-shadow: 0 0.125em 10px 3px rgba(46, 18, 107, 0.25);
        }
        .gps-bg__marker:after {
            content: '';
            border-left: 1.5em solid transparent;
            border-right: 1.5em solid transparent;
            border-bottom: 3em solid #6c38de;
            position: absolute;
            top: 20%;
            left: 50%;
            -webkit-transform: translateX(-50%);
            transform: translateX(-50%);
        }
    </style>
</head>
<body style="position: relative; min-height: 100%; margin: 0px; padding: 0px;">
<header class="hero hero--map gps-bg">

    <div class="gps-bg__guts">
        <div class="gps-bg__bg"></div>
        <div class="gps-bg__route"></div>
        <div class="gps-bg__marker animated backInDown"></div>
    </div>
<!--    <div class="gps-bg__fade"></div>-->

    <h1 class="hero__title">
        忘记密码
    </h1>

</header>
<div style="position: absolute; top: -120px; left: 0px; width: 100%; min-height: 100%;">
    <div class="loggedout_vcenter animated bounceIn">
        <div style="padding: 8px;margin-top: 400px">
            <div style="min-height:420px; max-width: 420px; padding:40px; background-color:#ffffff; margin-left: auto; margin-right: auto; border-radius:4px; overflow-x: hidden;">
                <div class="success_message" th:if="${smsg!=null}" th:text="${smsg}"></div>
                <div class="error_message" th:if="${mmsg!=null}" th:text="${mmsg}"></div>
                <div class="warning_message" th:if="${wmsg!=null}" th:text="${wmsg}"></div>
                <div class="success_message" id="smsg" style="display: none"></div>
                <div class="error_message" id="mmsg" style="display: none"></div>
                <div class="warning_message" id="wmsg" style="display: none"></div>
                <form>
                    <input id="email" name="email" type="text" style="width:100%;" placeholder="邮箱"
                           value="" required="required" autofocus="">
                    <hr class="hr15">
                    <input name="telnumber" id="telnumber" type="text" style="width:100%;" placeholder="手机号"
                           value="" required="required" autofocus="">
                    <hr class="hr15">
                    <input type="submit" class="button" id="regist" value="提交" lay-submit lay-filter="regist" style="width:100%;">
                    <hr class="hr20">
                    已有账号？<a href="/login">登录</a>
                </form>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">

    layui.extend({
        admin: '/static/js/admin'
    });
    layui.use(['form','admin'], function(){
        var form = layui.form
            ,admin = layui.admin
            ,$ = layui.$;     //一定要加载这个不然Jquery没法使用
        form.on('submit(regist)', function(data){
            var telnumber=$("#telnumber").val();
            var email=$("#email").val();
            var regext4=/^\w+([-\.]\w+)*@\w+([\.-]\w+)*\.\w{2,4}$/;    //邮箱验证
            if (!regext4.test(email)){
                layer.msg('请正确填写邮箱',{
                    icon:5,
                    time:1000
                });
                return false;
            }
            $("#regist").attr("disabled","disabled"); //发送邮件等待时间较长，为避免重复操作，提交表单后禁用按钮
            var loading =layer.load(0, {
            }); //加载中
            $.ajax({
                type: "POST",
                url: "/doforget",
                data: {"telphone":telnumber,"email":email},
                xhrFields:{withCredentials:true},
                success: function(data){
                    layer.close(loading); //关闭加载蒙层
                    if (data.code===200){
                        layer.msg("重置密码邮件已经通过邮件方式发送到您的邮箱，请注意查收！",{
                            icon:1,
                            time:1000,
                            success:function(layero){
                                window.location.href="/login";
                            }
                        });
                        return false;
                }else {
                        layer.msg(data.data,{
                            icon:2,
                            time:3000
                        });
                    }
                }
            });
            // layer.msg(JSON.stringify(data.field),function(){
            //     location.href='./index.html'
            // });
            return false;
        });
    });
</script>
</body>
</html>